const GuestTypeMap = {
  all: 0, //全部;
  staff: 1, //员工
  notGuest: 2, //非顾客;
  vip: 3, //会员
  oldGuest: 4, //老客
  newGuest: 5 //新客
}
const GuestKeyMap = {
  all: 'total', //全部;
  staff: 'staffs', //员工
  notGuest: 'blacks', //非顾客;
  vip: 'members', //会员
  oldGuest: 'oldCustomers', //老客
  newGuest: 'newCustomers' //新客
}
class GuestType {
  constructor(type = 0) {
    this.type = type;
  }
  set type(type) {
    this._type = type;
    this.name = this.setUpName(this._type);
    this.nameKey = FaceTypeToKey(this._type);
  }
  get type(){
    return this._type;
  }
  setUpName(type) {
    switch (type) {
      case GuestTypeMap.all:
        return '全部';
      case GuestTypeMap.staff:
        return '员工';
      case GuestTypeMap.notGuest:
        return '非顾客';
      case GuestTypeMap.vip:
        return '会员';
      case GuestTypeMap.oldGuest:
        return '老客';
      case GuestTypeMap.newGuest:
        return '新客';
      default:
        return '';
    }
  }
  setNameKey(type) {
    switch (type) {
      case GuestTypeMap.all:
        return '全部';
      case GuestTypeMap.staff:
        return '员工';
      case GuestTypeMap.notGuest:
        return '非顾客';
      case GuestTypeMap.vip:
        return '会员';
      case GuestTypeMap.oldGuest:
        return '老客';
      case GuestTypeMap.newGuest:
        return '新客';
      default:
        return '';
    }
  }
}
const FaceKpiName = (type)=>{
  switch (type) {
    case GuestTypeMap.all:
      return '全部';
    case GuestTypeMap.staff:
      return '员工';
    case GuestTypeMap.notGuest:
      return '非顾客';
    case GuestTypeMap.vip:
      return '会员';
    case GuestTypeMap.oldGuest:
      return '老客';
    case GuestTypeMap.newGuest:
      return '新客';
    default:
      return '';
  }
}
const FaceTypeToKey = function (type) {
  switch (type) {
    case GuestTypeMap.all:
      return GuestKeyMap.all;
    case GuestTypeMap.oldGuest:
      return GuestKeyMap.oldGuest
    case GuestTypeMap.newGuest:
      return GuestKeyMap.newGuest
    case GuestTypeMap.vip:
      return GuestKeyMap.vip;
    case GuestTypeMap.staff:
      return GuestKeyMap.staff;
    case GuestTypeMap.notGuest:
      return GuestKeyMap.notGuest
  }
  return '';
}

const GenderMap = {
  all: 0, //全部
  male: 1, //男;
  female: 2, //女
}

class Gender {
  constructor(type = 0) {
    this.type = type;
  }
  set type(type) {
    this._type = type;
    this.name = this.setUpName(this._type);
    this.nameKey = this.setNameKey(this._type);
  }
  setUpName(type) {
    switch (type) {
      case GenderMap.all:
        return '全部';
      case GenderMap.male:
        return '男';
      case GenderMap.female:
        return '女';
      default:
        return '';
    }
  }

  setNameKey(type) {
    switch (type) {
      case GenderMap.male:
        return 'male';
      case GenderMap.female:
        return 'female';
      default:
        return '';
    }
  }
}

const AgeMap = {
  all: 0, //全部
  age18: 1, //18-24;
  age25: 2, //25-29
  age30: 3, //30-39
  age40: 4, //40-49
  age50: 5, //50以上
}

class Age {
  constructor(type = 0) {
    this.type = type;
  }
  set type(type) {
    this._type = type;
    this.name = this.setUpName(this._type);
    this.nameKey = this.setNameKey(this._type);
  }
  setUpName(type) {
    switch (type) {
      case AgeMap.all:
        return '全部';
      case AgeMap.age18:
        return '18-24';
      case AgeMap.age25:
        return '25-29';
      case AgeMap.age30:
        return '30-39';
      case AgeMap.age40:
        return '40-49';
      case AgeMap.age50:
        return '50以上';
      default:
        return '';
    }
  }

  setNameKey(type) {
    switch (type) {
      case AgeMap.age18:
        return '18-24';
      case AgeMap.age25:
        return '25-29';
      case AgeMap.age30:
        return '30-39';
      case AgeMap.age40:
        return '40-49';
      case AgeMap.age50:
        return '50以上';
      default:
        return '';
    }
  }
}

module.exports = {
  GuestType: GuestType,
  GuestTypeMap: GuestTypeMap,
  GenderMap: GenderMap,
  Gender: Gender,
  Age: Age,
  AgeMap: AgeMap,
  GuestKeyMap: GuestKeyMap,
  FaceTypeToKey: FaceTypeToKey,
  FaceKpiName: FaceKpiName
}